﻿using System.Windows.Forms;
using System.Data;

namespace Связь_с_БД
{
    class SplitEntryForUpdate
    {
        private readonly DataGridViewRow _dgvr;

        private string[] _documentStudentValue;
        private string[] _examsValue;
        private string[] _jobsValue;
        private string[] _learningDataValue;
        private string[] _learningValue;
        private string[] _learningDataDocumentValue;
        private string[] _parentsValue;
        private string[] _paymentsValue;
        private string[] _previousEducationValue;
        private string[] _privateDataValue;

        public SplitEntryForUpdate(DataGridViewRow dataGridViewRow)
        {
            _dgvr = dataGridViewRow;
            SetAllData();
        }

        public string[] GetDocumentStudentValue()
        {
            return _documentStudentValue;
        }

        public string[] GetExamsValue()
        {
            return _examsValue;
        }

        public string[] GetJobsValue()
        {
            return _jobsValue;
        }

        public string[] GetLearningDataValue()
        {
            return _learningDataValue;
        }

        public string[] GetLearningValue()
        {
            return _learningValue;
        }

        public string[] GetLearningDataDocumentValue()
        {
            return _learningDataDocumentValue;
        }

        public string[] GetParentsValue()
        {
            return _parentsValue;
        }

        public string[] GetPaymentsValue()
        {
            return _paymentsValue;
        }

        public string[] GetPreviousEducationValue()
        {
            return _previousEducationValue;
        }

        public string[] GetPrivateDataValue()
        {
            return _privateDataValue;
        }

        private void SetDocumentStudentValue()
        {
            _documentStudentValue = new string[10];
            for (int i = 0; i < 10;i++ )
                _documentStudentValue[i] = _dgvr.Cells[i+44].Value.ToString();
            
        }

        private void SetExamsValue()
        {
            _examsValue = new string[9];
            for (int i = 0; i < 9; i++)
               _examsValue[i] = _dgvr.Cells[i + 100].Value.ToString();
        }

        private void SetJobsValue()
        {
            _jobsValue = new string[6];
            for (int i = 0; i < 6; i++)
                _jobsValue[i] = _dgvr.Cells[i + 59].Value.ToString();
        }

        private void SetLearningDataValue()
        {
            _learningDataValue = new string[13];
            for (int i = 0; i < 13; i++)
                _learningDataValue[i] = _dgvr.Cells[i + 13].Value.ToString();
        }

        private void SetLearningValue()
        {
            _learningValue = new string[9];
            for (int i = 0; i < 9; i++)
                _learningValue[i] = _dgvr.Cells[i + 90].Value.ToString();
        }

        private void SetLearningDataDocumentValue()
        {
            _learningDataDocumentValue = new string[8];
            for (int i = 0; i < 8; i++)
                _learningDataDocumentValue[i] = _dgvr.Cells[i + 66].Value.ToString();
        }

        private void SetParentsValue()
        {
            _parentsValue = new string[4];
            for (int i = 0; i < 4; i++)
                _parentsValue[i] = _dgvr.Cells[i + 85].Value.ToString();
        }

        private void SetPaymentsValue()
        {
            _paymentsValue = new string[3];
            for (int i = 0; i < 3; i++)
                _paymentsValue[i] = _dgvr.Cells[i + 55].Value.ToString();
        }

        private void SetPreviousEducationValue()
        {
            _previousEducationValue = new string[9];
            for (int i = 0; i < 9; i++)
                _previousEducationValue[i] = _dgvr.Cells[i + 75].Value.ToString();
        }

        private void SetPrivateDataValue()
        {
            _privateDataValue = new string[16];
            for (int i = 0; i < 16; i++)
                _privateDataValue[i] = _dgvr.Cells[i + 27].Value.ToString();
        }

        public void SetAllData()
        {
            SetDocumentStudentValue();
            SetExamsValue();
            SetJobsValue();
            SetLearningDataDocumentValue();
            SetLearningDataValue();
            SetLearningValue();
            SetParentsValue();
            SetPaymentsValue();
            SetPreviousEducationValue();
            SetPrivateDataValue();
        }

    }
}
